Section III: Dear Data

Coppock, Padmanabhan, Singh

23 September 2021

Each week Giorgia Lupi and Stefanie Posavec collected and measured a particular type of data about their lives, used this data to make a drawing on a postcard-sized sheet of paper, then mailed the postcard to the other person.

Homework

  1. You and your partner decide to track the same data for seven days.
  2. Visualize your data by hand
  3. Take a picture of your drawing, then send the drawing to your partner
  4. Choose any Dear Data figure, create the data that makes the figure, and re-visualize the data using ggplot2

Example (Week 26)

Legend

The Data

dear_data <- read_excel("dear_data.xlsx") %>% 
  mutate(Gender = as.factor(Gender))

head(dear_data) %>% 
  kable(caption =  "Tidiness and Stuff Under the Desk")
Tidiness and Stuff Under the Desk
tidiness under_desk Gender x y
2 1 woman 1 4
3 1 man 2 4
0 1 man 3 4
2 0 unknown 4 4
2 1 man 5 4
1 0 man 6 4

Visualizing in ggplot2

library(ggthemes)

plot1 <- 
  ggplot(dear_data, 
         aes(x = tidiness, 
             y = under_desk)) +
  geom_point() + 
  xlab("Tidiness (0 to 3)") +
  ylab("Stuff Under Desk (0 or 1)") +
  theme_economist_white(gray_bg = F) +
  theme(axis.title.x = element_text(size = 16),
        axis.title.y = element_text(size = 16))

Adding a jitter

library(ggthemes)

plot2 <- 
  ggplot(dear_data, 
         aes(x = tidiness, 
             y = under_desk)) +
    geom_point(position = position_jitter(width = 0.1, height = 0.1)) + 
  xlab("Tidiness (0 to 3)") +
  ylab("Stuff Under Desk (0 or 1)") +
  theme_economist_white(gray_bg = F) +
  theme(legend.position = "bottom",
        axis.title.x = element_text(size = 16),
        axis.title.y = element_text(size = 16))

Adding Dimensions

library(estimatr)

plot3 <-
  ggplot(dear_data, 
         aes(x = tidiness,
             y = under_desk,
             color = Gender)) +
  geom_point(alpha = 0.4, 
             size = 3,
             position = position_jitter(width = 0.1, height = 0.1)) + 
  geom_smooth(method= "lm_robust", se= FALSE) +
  xlab("Tidiness (0 to 3)") + ylab("Stuff Under Desk (0 or 1)") +
  theme_economist_white(gray_bg = F) +
  theme(legend.position = "bottom",
        axis.title.x = element_text(size = 16),
        axis.title.y = element_text(size = 16))

Facet Wrapping

plot4 <-
  ggplot(dear_data, 
         aes(x = tidiness,
             y = under_desk)) +
 geom_point(alpha = 0.4, 
             size = 3,
             position = position_jitter(width = 0.1, height = 0.1)) + 
  xlab("Tidiness (0 to 3)") + ylab("Stuff Under Desk (0 or 1)") +
  theme_economist_white(gray_bg = F) +
  theme(legend.position = "bottom",
        axis.title.x = element_text(size = 16),
        axis.title.y = element_text(size = 16)) +
  facet_wrap(~Gender, nrow = 1)

Heat Map

plot5 <-
  ggplot(dear_data, 
         aes(x = x,
             y = y)) +
  geom_tile(aes(fill = tidiness), color = "gray80") +
  geom_text(aes(label = Gender)) +
  scale_fill_gradient(low = "lightblue1", high = "dodgerblue2") +
  theme_tufte() +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

Task

  1. Form pairs, download the postcard from Week 26, our dataset and section code.
  2. In Excel, create two new columns: computer type and familiarity. Use the legend to code values for each variable.
  3. Visualize the new variables using ggplot2. You can use one or some of the existing columns in the dataset.